/**
 * Copyright 2009. Felix Dorner.
 * This code is licensed under the Eclipse Public License v1.0
 * http://www.eclipse.org/org/documents/epl-v10.html
 *
 * $Id$
 */
package com.objectcarpentry.kaylee.provider;


import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemFontProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITableItemColorProvider;
import org.eclipse.emf.edit.provider.ITableItemFontProvider;
import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import com.objectcarpentry.kaylee.KayleePackage;
import com.objectcarpentry.kaylee.PlayableState;
import com.objectcarpentry.kaylee.PlaylistEntry;
import com.objectcarpentry.kaylee.Track;

/**
 * This is the item provider adapter for a {@link com.objectcarpentry.kaylee.PlaylistEntry} object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class PlaylistEntryItemProvider
	extends PlayableItemProvider
	implements
		IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final String copyright = "Copyright 2009. Felix Dorner.\nThis code is licensed under the Eclipse Public License v1.0\nhttp://www.eclipse.org/org/documents/epl-v10.html";

	/**
	 * This constructs an instance from a factory and a notifier.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PlaylistEntryItemProvider(AdapterFactory adapterFactory) {
		super(adapterFactory);
	}

	/**
	 * This returns the property descriptors for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
		if (itemPropertyDescriptors == null) {
			super.getPropertyDescriptors(object);

			addTrackPropertyDescriptor(object);
		}
		return itemPropertyDescriptors;
	}

	/**
	 * This adds a property descriptor for the Track feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addTrackPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_PlaylistEntry_track_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_PlaylistEntry_track_feature", "_UI_PlaylistEntry_type"),
				 KayleePackage.Literals.PLAYLIST_ENTRY__TRACK,
				 true,
				 false,
				 true,
				 null,
				 null,
				 null));
	}

	

	/**
	 * This handles model notifications by calling {@link #updateChildren} to update any cached
	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void notifyChanged(Notification notification) {
		updateChildren(notification);
		super.notifyChanged(notification);
	}

	/**
	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
	 * that can be created under this object.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
		super.collectNewChildDescriptors(newChildDescriptors, object);
	}

	
	/**
	 * This returns PlaylistEntry.gif.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	@Override
	public Object getImage(Object object) {
		Track t = ((PlaylistEntry) object).getTrack();
		IItemLabelProvider p = (IItemLabelProvider) adapterFactory.adapt(t, IItemLabelProvider.class);
		if (p != null){
			return p.getImage(object);
		} else {
			return null;
		}
	}

	/**
	 * This returns the label text for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	@Override
	public String getText(Object object) {
		Track t = ((PlaylistEntry) object).getTrack();
		IItemLabelProvider p = (IItemLabelProvider) adapterFactory.adapt(t, IItemLabelProvider.class);
		if (p != null){
			return p.getText(object);
		} else {
			return null;
		}
	}
	
	@Override
	public String getColumnText(Object o, int column){
		Track t = ((PlaylistEntry) o).getTrack();
		ITableItemLabelProvider p = (ITableItemLabelProvider) adapterFactory.adapt(t, ITableItemLabelProvider.class);
		if (p != null){
			return p.getColumnText(t, column);
		} else {
			return getText(o);
		}
	}
	
	@Override
	public Object getColumnImage(Object o, int column){
		Track t = ((PlaylistEntry) o).getTrack();
		ITableItemLabelProvider p = (ITableItemLabelProvider) adapterFactory.adapt(t, ITableItemLabelProvider.class);
		if (p != null){
			return p.getColumnImage(t, column);
		} else {
			return getImage(o);
		}
	}
	
}
